﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TravelLink.WebModel;


namespace TravelLink.WebApp.UserControl.Company {
    public partial class UC_Company_Right : ControlBase {





        public string ISTVal { get; set; }
        public string ISTName { get; set; }



        protected void Page_Load(object sender, EventArgs e) {
            this.dropPublish.SelectedValue = "0";
            if (DT > 0) {
                this.dropPublish.SelectedValue = DT.ToString();
            }
            this.drpPositionLv.DataSource = this.DB.TL_PositionLevel;
            this.drpPositionLv.DataTextField = "Name";
            this.drpPositionLv.DataValueField = "Idx";
            this.drpPositionLv.DataBind();
            this.drpPositionLv.Items.Insert(0, new ListItem("--不限--", "-1"));
            if (this.DB.TL_PositionLevel.Where(u => u.Idx == PL).FirstOrDefault() != null) {
                drpPositionLv.SelectedValue = PL.ToString();
            }


            this.drpPositionJobType.DataSource = this.DB.TL_PositionType;
            this.drpPositionJobType.DataTextField = "Name";
            this.drpPositionJobType.DataValueField = "Idx";
            this.drpPositionJobType.DataBind();
            this.drpPositionJobType.Items.Insert(0, new ListItem("--不限--", "-1"));
            if (this.DB.TL_PositionType.Where(u => u.Idx == PT).FirstOrDefault() != null) {
                drpPositionJobType.SelectedValue = PT.ToString();
            }

            if (IST.Length > 0) {
                var istEntity = this.DB.TL_IndustryType2.Where(u => IST.Contains(u.Idx));
                if (istEntity != null) {
                    this.ISTVal = string.Join(",", IST);
                    this.ISTName = string.Join(",", istEntity.Select(u => u.Name));      //istEntity.Name;
                }
            }
        }
    }
}